﻿using System;
using dotnet_graphql_demo.Model;
using HotChocolate;
using HotChocolate.Subscriptions;
using Mapster;
using System.Threading.Tasks;
using GraphQL.Types;

namespace dotnet_graphql_demo.Infrastructure.Graphql
{
    public class OwnerMutation
    {
        public async Task<Owner> AddOwner(OwnerInput ownerInput, [Service] IOwnerRepository ownerRepository)
        {
            Owner owner = ownerInput.Adapt<Owner>();
            owner.Id = new System.Guid();
            await ownerRepository.CreateOwnerAsync(owner);
            return await Task.FromResult(owner);
        }
    }
}